package org.example;

import cn.hserver.core.server.util.JsonResult;
import cn.hserver.plugin.rpc.annotation.Resource;
import cn.hserver.plugin.web.annotation.Controller;
import cn.hserver.plugin.web.annotation.GET;
import cn.hserver.plugin.web.annotation.POST;
import cn.hserver.plugin.web.annotation.WebSocket;
import cn.hserver.plugin.web.context.PartFile;
import cn.hserver.plugin.web.handlers.Ws;
import cn.hserver.plugin.web.interfaces.HttpRequest;
import cn.hserver.plugin.web.interfaces.HttpResponse;
import cn.hserver.plugin.web.interfaces.WebSocketHandler;

import java.io.File;

@WebSocket("/ws")
public class WebController implements WebSocketHandler {


    @Override
    public void onConnect(Ws ws) {

    }

    @Override
    public void onMessage(Ws ws) {
        String message = ws.getMessage();
        System.out.println(message);
        ws.send("msg:"+message);
    }

    @Override
    public void disConnect(Ws ws) {

    }
}
